package stringBuilder;

/**
 * StringBuilder
 * 作用：提高字符串的操作效率
 */

public class Demo01 {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i <= 50000; i++) {
            sb.append(1);
        }
        long end = System.currentTimeMillis();
        System.out.println(end - start);
    }

    public static void methods() {
        long start = System.currentTimeMillis();
        String s = "";
        for (int i = 1; i <= 50000; i++) {
            s += 1;
        }
        long end = System.currentTimeMillis();
        System.out.println(end - start);
    }
}
